package com.myCommon.security.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.myCommon.security.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface UserMapper extends BaseMapper<User> {
      
      
      @Select("SELECT \n" +
            "DISTINCT m.perms\n" +
            "FROM\n" +
            "sys_user u JOIN sys_user_role ur ON u.id=ur.user_id\n" +
            "JOIN sys_role_menu rm ON ur.role_id=rm.role_id\n" +
            "JOIN sys_menu m ON m.id=rm.menu_id\n" +
            "WHERE\n" +
            "u.id=#{userId}")
      List<String> getUserAuthByUserId(@Param("userId") Long userId);
}
